<template>
	<view class="content">
		<uni-nav-bar @clickLeft="toback" backgroundColor="#ffffff" left-icon="back" title="个性设置" color="#15151B"
			:fixed="true" :statusBar="true" :border="false"></uni-nav-bar>
		<view class="mine-ul bott">
			<view class="two-box" @click="go(item.href,item.name)" v-for="(item,index) in menulist">
				<view class="two-text">
					{{item.name}}
				</view>
				<view class="two-box-img2">
					<image src="../../static/image/my/right.png" mode=""></image>
				</view>
			</view>
		</view>
		<view class="xian"></view>
		<view class="logout" @click="logout">退出登录</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				menulist:[],
			}
		},
		onLoad() {
			this.getPerSetting();
		},
		methods: {
			logout(){
				uni.clearStorageSync();
				uni.redirectTo({
					url: '/pages/login/login'
				})
			},
			getPerSetting() {
				var token = '';
				var uid = 0;
				if(uni.getStorageSync('token')){
					token = uni.getStorageSync('token');
					uid = uni.getStorageSync('uid');
				}
				this.$api.sendRequest({
					data:{
						service:'User.getPerSetting',
						uid:uid,
						token:token,
					},
					success: res => {
						if(res.data.code == 0){
							var param = res.data.info;
							this.menulist = param;
							// console.log(param)
						}else{
							var msg = res.msg == '' ? res.data.msg : res.msg;
							uni.showToast({
								icon: "none",
								title: msg,
							});
						}
					}
				});
				
			},
			toback() {
				uni.switchTab({
					url: "/pages/my/my",
				})
			},
			go(e,name){
				if(name == '个性设置'){
					// uni.redirectTo({
					// 	url: './set'
					// })
				}else{
					var url = '/pages/my/set';
					uni.setStorageSync('src',e);
					uni.redirectTo({
						// url: '/pages/index/webview?backtype=2&url=' + url + '&src=' + e,
						url: '/pages/index/webview?backtype=2&url=' + url,
					})
				}
			},
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #f2f2f2;
	}
	.logout{
		margin-top: 20rpx;
		width: 100%;
		text-align: center;
		background-color: #FFFFFF;
		padding: 30rpx 0;
		font-size: 32rpx;
	}
	.mine-ul{
		width: 690rpx;
		margin: 0 auto;
		margin-top: 10rpx;
		background: #FFFFFF;
		border-radius: 8rpx;
		padding: 15rpx 30rpx;
		.nobox{
			border-bottom:0 !important;
		}
		.two-box:last-child{
			border-bottom: none !important;
		}
		.two-box {
			background: #FFFFFF;
			display: flex;
			height: 120rpx;
			align-items: center;
			border-bottom: 2rpx solid #e8e7e785;
			
		
			.two-text {
				flex: 1;
				font-size: 32rpx;
				
				color: #1D1D1D;
			}
		
			.two-box-img2 {
				height: 30rpx;
				width: 30rpx;
				// margin: 0 32rpx;
		
				image {
					width: 100%;
					height: 100%;
				}
			}
		}
	}
	.bott{
		// margin-bottom: 150rpx;
	}
</style>
